<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>用户登录</title>
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <meta name="Keywords" content="网站关键词">
    <meta name="Description" content="网站介绍">
    <link rel="stylesheet" href="/Sign_in/css/base.css">
    <link rel="stylesheet" href="/Sign_in/css/iconfont.css">
    <link rel="stylesheet" href="/Sign_in/css/reg.css">
</head>
<body>
<div id="ajax-hook"></div>
<div class="wrap">
    <div class="wpn">
        <div class="form-data pos">
            <form class="layui-form">
                <a href="/front/frontIndex"><img src="/Sign_in/img/logo.png" class="head-logo"></a>
                <div class="change-login">
                    <p class="account_number on">账号登录</p>
                    <p class="message">短信登录</p>
                </div>
                <div class="form1">
                    <p class="p-input pos">
                        <label for="phoneNum">手机号/用户名/UID/邮箱</label>
                        <input type="text" name="phoneNum" id="phoneNum">
                        <span class="tel-warn num-err hide"><em>账号或密码错误，请重新输入</em><i class="icon-warn"></i></span>
                    </p>
                    <p class="p-input pos">
                        <label for="password">请输入密码</label>
                        <input type="password" name="password" id="password" autocomplete="new-password">
                        <span class="tel-warn pass-err hide"><em>账号或密码错误，请重新输入</em><i class="icon-warn"></i></span>
                    </p>
                    <p class="p-input pos code hide">
                        <label for="veri">请输入验证码</label>
                        <input type="text" id="veri">
                        <img src="">
                        <span class="tel-warn img-err hide"><em>账号或密码错误，请重新输入</em><i class="icon-warn"></i></span>
                        <!-- <a href="javascript:;">换一换</a> -->
                    </p>
                </div>
                <div class="form2 hide">
                    <p class="p-input pos">
                        <label for="num2">手机号</label>
                        <input type="number" id="num2">
                        <span class="tel-warn num2-err hide"><em>账号或密码错误</em><i class="icon-warn"></i></span>
                    </p>
                    <p class="p-input pos">
                        <label for="veri-code">输入验证码</label>
                        <input type="number" id="veri-code">
                        <a href="javascript:;" class="send">发送验证码</a>
                        <span class="time hide"><em>120</em>s</span>
                        <span class="tel-warn error hide">验证码错误</span>
                    </p>
                </div>
                <div class="r-forget cl">
                    <a href="/front/frontReg" class="z">账号注册</a>
                    <a href="/front/frontGetpass" class="y">忘记密码</a>
                </div>
                <button class="lang-btn off log-btn" lay-submit lay-filter="login">登录</button>
            </form>
            <div class="third-party">
                <a href="#" class="log-qq icon-qq-round"></a>
                <a href="#" class="log-qq icon-weixin"></a>
                <a href="#" class="log-qq icon-sina1"></a>
            </div>
            <p class="right">Powered by © 2018</p>
        </div>
    </div>
</div>
<script src="/Sign_in/js/jquery.js"></script>
<script src="/Sign_in/js/agree.js"></script>
<script src="/Sign_in/js/login.js"></script>
<script src="/layui/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>


<script>
    layui.use(['form'], function () {
        var form = layui.form,
            layer = layui.layer,
            $ = layui.$;

        // 登录过期的时候，跳出ifram框架
        if (top.location != self.location) top.location = self.location;

        // 进行登录操作
        form.on('submit(login)', function (data) {
            data = data.field;
            if (data.phoneNum == '') {
                layer.msg('手机号不能为空');
                return false;
            }
            if (data.password == '') {
                layer.msg('密码不能为空');
                return false;
            }

            $.ajax({
                url: '/userLogin/advertisingLogin',
                type: 'post',
                data: data,
                dataType: 'json',
                success: function (result) {
                    if (result.code == '0') {
                            window.location = '/front/frontIndex';
                    } else {
                        layer.msg(result.msg)
                    }
                }
            });
            return false;
        });
    });
</script>

<%--<script>--%>
<%--    /**--%>
<%--     * 登录--%>
<%--     */--%>
<%--    function advertisingLogin() {--%>
<%--        var $ = layui.jquery;--%>

<%--        var phoneNum = document.getElementById("phoneNum").value;--%>
<%--        var password = document.getElementById("password").value;--%>

<%--        console.log(phoneNum.length);--%>
<%--        if(phoneNum.length == 11 && password != ''){--%>
<%--            $.ajax({--%>
<%--                url: '/userLogin/advertisingLogin?phoneNum=' + phoneNum + '&password=' + password,--%>
<%--                type: 'post',--%>
<%--                dataType: 'json',--%>
<%--                success: function (result) {--%>
<%--                    if (result.code == '1') {--%>
<%--                        window.location = '/front/frontIndex';--%>
<%--                    } else {--%>
<%--                        layer.msg(result.msg)--%>
<%--                    }--%>
<%--                }--%>
<%--            });--%>
<%--        }else {--%>
<%--            layer.msg("请输入正确的格式!");--%>
<%--        }--%>
<%--    }--%>
<%--</script>--%>
</body>
</html>
